from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from django.shortcuts import render
from django.db import connection
import requests
import json
import time
import os
from django.http import HttpResponseRedirect
from django.urls import reverse


class File_object:
    def __init__(self, file_name, title, content, score):
        self.file_name = file_name
        self.title = title
        self.content = content
        self.score = score


def write_to_txt_file(txt_date_str, select_VALUE, file_path):
    split_str = "===================us6oQEaVioXlcSTf0Ju85pxtCMZofElWcfPRjY8y6CfkcveyuQUn4iYr==================="
    all_string_data = txt_date_str+"\n\n"+split_str+"\n\n"+select_VALUE
    with open(file_path, "w", encoding="utf-8") as f:
        f.write(all_string_data)  # 加\n换行显示


def clean_string(string_data):
    string_data = string_data.replace("adj." , "  ")
    string_data = string_data.replace("n." , "  ")
    string_data = string_data.replace("v." , "  ")
    return string_data